package com.sgu6.middleware.util;

import java.util.Calendar;

public class DateUtils {

    static Calendar calendar = Calendar.getInstance();

    public static String getDay() {
        //获取系统的日期
//年
        int year = calendar.get(Calendar.YEAR);
//月
        int month = calendar.get(Calendar.MONTH) + 1;
//日
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        return String.valueOf(year) + String.valueOf(month) + String.valueOf(day);
    }

    public static String getPreDay() {
        //获取系统的日期
//年
        int year = calendar.get(Calendar.YEAR);
//月
        int month = calendar.get(Calendar.MONTH) + 1;
//日
        int day = calendar.get(Calendar.DAY_OF_MONTH) - 1;
        return String.valueOf(year) + String.valueOf(month) + String.valueOf(day);
    }
}
